﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BugTracker.Core.Infrastructure.Interfaces;

namespace BugTracker.BTGridView
{
    [Serializable]
    public sealed class Pager : IPager
    {
        #region fields

        private int pageCount = 0;
        private int pageIndex = 0;

        #endregion

        #region ctor

        public Pager() { }

        public Pager(int pageCount, int pageIndex)
        {
            this.pageCount = pageCount;
            this.pageIndex = pageIndex;
        }

        #endregion

        #region IPager Members

        public int PageCount
        {
            get { return pageCount; }
        }

        public int PageIndex
        {
            get { return pageIndex; }
        }

        public bool HasNextPage
        {
            get 
            {
                return (pageIndex < pageCount) ? true : false;
            }
        }

        public bool HasPrevPage
        {
            get 
            {
                return (pageIndex > 0) ? true : false; 
            }
        }

        #endregion
    }
}
